using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BlogEngine.Core.Providers;
using BlogEngine.Core;

public partial class admin_viewphotoalbums : System.Web.UI.Page
{
	protected Guid guid;

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!Page.IsPostBack)
		{
			if (Request.QueryString["Action"] != null)
			{
				string action = Request.QueryString["Action"];
				Photo photo = Photo.GetById(new Guid(Request.QueryString["PhotoId"]));

				switch (action.ToLower())
				{
					case "top": Photo.MoveFirst(photo); break;
					case "up": Photo.MoveUp(photo); break;
					case "down": Photo.MoveDown(photo); break;
					case "bottom": Photo.MoveLast(photo); break;
					default: break;
				}

				Response.Redirect("ViewPhotoAlbum.aspx?AlbumId=" + photo.Album.Id.ToString());
			}

			guid = new Guid(Request.QueryString["AlbumId"]);
			BindPhotos();
		}

		Page.Title = Resources.labels.photos;
	}

	#region Event handlers

	#endregion

	#region Data Binding

	private void BindPhotos()
	{
		AlbumContent.DataSource = Album.GetById(guid).Photos;
		AlbumContent.DataBind();
	}

	#endregion


}
